<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>身份证号码提取生日信息</title>
</head>
<body>
    <input type="text" id="idNumber" placeholder="请输入身份证号码">
    <button onclick="extractBirthday()">提取生日</button>
    <div id="showBirthday"></div>

    <script>
        function extractBirthday() {
            const idNumber = document.getElementById('idNumber').value;
            if (idNumber.length !== 18) {
                document.getElementById('showBirthday').textContent = '请输入正确的18位身份证号码';
                return;
            }

            const year = idNumber.slice(6, 10);
            const month = idNumber.slice(10, 12);
            const day = idNumber.slice(12, 14);

            const birthday = `${year}年${month}月${day}日`;
            document.getElementById('showBirthday').textContent = `生日：${birthday}`;
        }
    </script>
</body>
</html>